#pragma once

#include"fpqfile_global.h"

#include <QObject>
#include <QVector>
#include <QMap>
#include <QVariant>

FP_QFILE_BEGIN

class FPQFILE_EXPORT FpQJsonFile  : public QObject
{
public:
	FpQJsonFile(QObject *parent = nullptr);
	~FpQJsonFile();

	static void WriteJsonFile(const QString& filename, const QMap<QString, QVector<QMap<QString, QString>>>& data);
	static QMap<QString, QVector<QMap<QString, QString>>> ReadJsonFile(const QString& filename);

	static void WriteJson(const QString& filename, QMap<QString, QVariant> element,const QMap<QString,QString>& variantType);
	static QMap<QString, QVariant> ReadJson(const QString& filename,QMap<QString,QString>& variantType);

	static void WriteQString(const QString& filename, const QString& key, const QString& value);
	static QString ReadQString(const QString& filename, const QString& key);

	static void WriteInt(const QString& filename, const QString& key, int value);
	static int ReadInt(const QString& filename, const QString& key);

	static void WriteDouble(const QString& filename, const QString& key, double value);
	static int ReadDouble(const QString& filename, const QString& key);
};

FP_QFILE_END